<?php 
require_once("conn.php"); 
$code=$_GET['code'];
if($code==""){
	
	$code = "001";
}
$valueL = mysql_fetch_array(mysql_query("select value from t_dict_news where code='".$code."'"));
$value = $valueL[0];
$perpagenum = 15;//定义每页显示几条 
$total = mysql_fetch_array(mysql_query("select count(*) from v_app_news"));//查询数据库中一共有多少条数据 
$Total = $total[0]; // 
$Totalpage = ceil($Total/$perpagenum);//上舍，取整 
if(!isset($_GET['page'])||!intval($_GET['page'])||$_GET['page']>$Totalpage)//page可能的四种状态 
{ 
$page=1; 
} 
else 
{ 
$page=$_GET['page'];//如果不满足以上四种情况，则page的值为$_GET['page'] 
} 
$startnum = ($page-1)*$perpagenum;//开始条数 
$sql = "select * from v_app_news order by id limit $startnum,$perpagenum";//查询出所需要的条数 

$rs = mysql_query($sql); 
?> 


 

<?php
	echo " <ul class='nav'> <li >首页</li><li> &gt;&gt;<li><li>公司新闻&gt;&gt;$value</li></ul>  " ;
	echo "<h3>$value </h3>";
	?>
 

<h3><?php 
			$per = $page - 1;//上一页 
			$next = $page + 1;//下一页 
			/*echo "<div style='font-size:14px;font-weight: bold;color: #000;overflow:hidden; '>共有".$Total."条记录  共".$Totalpage."页 "; */
			if($page != 1) 
			{ 
			echo "<a style='font-size:14px;font-weight: bold;color: #000;' href='".$_SERVER['PHP_SELF']."'>首页</a>"; 
			echo "<a style='font-size:14px;font-weight: bold;color: #000;' href='".$_SERVER['PHP_SELF'].'?page='.$per."'> 上一页</a>"; 
			} 
			if($page != $Totalpage) 
			{ 
			echo "<a style='font-size:14px;font-weight: bold;color: #000;' href='".$_SERVER['PHP_SELF'].'?page='.$next."'> 下一页</a>"; 
			echo "<a style='font-size:14px;font-weight: bold;color: #000;' href='".$_SERVER['PHP_SELF'].'?page='.$Totalpage."'> 尾页</a></div>"; 
			} 
			?></h3>
<div class="content newsList">
<ul id="news_item_list" class="newsList">

 <?php
					while($row=mysql_fetch_array($rs)){
	
						$id=$row["id"];
						$type="info";
					    $encode="utf-8";
						echo "<li><span>
						<a href='newscontant.php?id=$id&type=$type'/ title=".$row['title'].">".mb_substr($row["title"],0,80,$encode)."...</a></span><span class='idtime'>".$row["date"]."</span></li>";
					}
					?>
                 
                    
                    
                    
                    
</ul>

<div class="list">
    <div class="pagination">
        1/1
		
        <select name="type"  onchange="gotoPage(this.options[this.options.selectedIndex].value);">
  				  				   	        	              		           <option value="1" selected>1</option>
  						</select>
</div>

</div>


<script language="JavaScript" type="text/javascript">
   function gotoPage(pageNum){
     location.href="/news/index_"+ pageNum + ".html";
   }
</script>
</div>